package com.young.monitor.cloud;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.web.client.RestTemplate;

/**
 * xxx
 *
 * @author imrookie
 * @date 2019/3/19
 */
@SpringBootApplication
@EnableEurekaClient
@ComponentScan("com.young")
@EnableFeignClients("com.young")
public class MonitorApplication {

    private static final Logger logger = LoggerFactory.getLogger(MonitorApplication.class);

    /**
     * 程序入口，启动springboot
     * @param args
     */
    public static void main(String[] args) {
        SpringApplication.run(MonitorApplication.class, args);
        logger.info("[监控中心] 监控中心启动完成.");
    }

    /**
     * feign需要声明RestTemplate
     * @return
     */
    @Bean
    @LoadBalanced
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }
}
